package com.dominator.repository;

import com.dominator.mybatis.dao.T_modulesDao;
import com.dominator.utils.dao.JdbcHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Repository
public class DaoModules {


    @Resource
    JdbcHelper jh;


    @Autowired
    T_modulesDao t_modulesDao;


    public List<Map<String, Object>> getModules(Integer classify) {
        StringBuilder sb = new StringBuilder();
        sb.append(" SELECT                                ");
        sb.append("	modules_name,             ");
        sb.append("	modules_classify,             ");
        sb.append("	icon_url,             ");
        sb.append("	base_url,             ");
        sb.append("	remark,             ");
        sb.append("	sort             ");
        sb.append(" FROM             ");
        sb.append("	t_modules             ");
        sb.append(" WHERE             ");
        sb.append("	modules_type = '0'             ");
        sb.append(" AND is_valid = '1'             ");
        sb.append(" AND modules_classify='"+classify+"' ");
        return jh.getList(sb.toString());

    }




    public List<Map<String, Object>> getBanner() {
        StringBuilder sb = new StringBuilder();
        sb.append(" SELECT                                ");
        sb.append("	title,             ");
        sb.append("	url,               ");
        sb.append("	content            ");
        sb.append("	FROM   t_img       ");
        sb.append("	WHERE  type='0'    ");
        sb.append(" AND is_valid = '1' ");
        return jh.getList(sb.toString());

    }
}
